package com.mall.common.util;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.xml.bind.annotation.adapters.XmlAdapter;

public class JaxbDateAdapter extends XmlAdapter<String, Date>{

    private DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  

	@Override  
	public Date unmarshal(String v) throws Exception {  
		return dateFormat.parse(v);  
	}  
	
	@Override  
	public String marshal(Date date) throws Exception {  
		return dateFormat.format(date);  
	}  

}
